package ink.lovejinhu.base;

import java.util.ArrayList;

/**
 * @author jinhu
 * created 2021-06-29 16:17
 */
public class XiaoMi02 {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * @param s string字符串
     * @return string字符串
     */
    public String unique_string(String s) {
        // write code here
        char[] chars = s.toCharArray();
        ArrayList<Character> characters = new ArrayList<>();
        for (int i = 0; i < chars.length; i++) {
            if (!characters.contains(chars[i])){
                characters.add(chars[i]);
            }
        }
        StringBuilder stringBuilder = new StringBuilder();
        for (Character temp:characters
             ) {
            stringBuilder.append(temp);

        }

        return stringBuilder.toString();

    }

    public static void main(String[] args) {
        XiaoMi02 xiaoMi02 = new XiaoMi02();
        System.out.println(xiaoMi02.unique_string("hellowelcometoxiaomi"));
    }
}
